<form #form (ngSubmit)="submit()" [appApiAction]="formPromise">
    <header>
        <div class="left">
            <button type="button" appBlurClick (click)="back()">
                <span class="header-icon"><i class="fa fa-chevron-left" aria-hidden="true"></i></span>
                <span>{{'back' | i18n}}</span>
            </button>
        </div>
        <div class="center">
            <span class="title">{{'attachments' | i18n}}</span>
        </div>
        <div class="right">
            <button type="submit" appBlurClick [disabled]="form.loading">
                <span [hidden]="form.loading">{{'save' | i18n}}</span>
                <i class="fa fa-spinner fa-lg fa-spin" [hidden]="!form.loading" aria-hidden="true"></i>
            </button>
        </div>
    </header>
    <content>
        <div class="box" *ngIf="cipher && cipher.hasAttachments">
            <div class="box-content no-hover">
                <div class="box-content-row box-content-row-flex" *ngFor="let a of cipher.attachments">
                    <div class="row-main">
                        {{a.fileName}}
                    </div>
                    <small class="row-sub-label">{{a.sizeName}}</small>
                    <div class="action-buttons no-pad">
                        <button class="row-btn btn" type="button" appStopClick appBlurClick
                            appA11yTitle="{{'deleteAttachment' | i18n}}" (click)="delete(a)" #deleteBtn
                            [appApiAction]="deletePromises[a.id]" [disabled]="deleteBtn.loading">
                            <i class="fa fa-trash-o fa-lg fa-fw" [hidden]="deleteBtn.loading" aria-hidden="true"></i>
                            <i class="fa fa-spinner fa-spin fa-lg fa-fw" [hidden]="!deleteBtn.loading"
                                aria-hidden="true"></i>
                        </button>
                    </div>
                </div>
            </div>
        </div>
        <div class="box">
            <div class="box-header">
                {{'newAttachment' | i18n}}
            </div>
            <div class="box-content no-hover">
                <div class="box-content-row">
                    <label for="file">{{'file' | i18n}}</label>
                    <input type="file" id="file" name="file" required>
                </div>
            </div>
            <div class="box-footer">
                {{'maxFileSize' | i18n}}
            </div>
        </div>
    </content>
</form>
